package org.example;

import io.netty.channel.Channel;
import io.netty.util.Attribute;

/**
 * 判断登录的工具
 */
public class LoginUtil {
    public static void markAsLogin(Channel channel){
        // 给通道设置属性，表示登录状态
        channel.attr(Attributes.LOGIN).set(true);
    }

    public static boolean hasLogin(Channel channel){
        Attribute<Boolean> attr = channel.attr(Attributes.LOGIN);
        return attr.get() != null;
    }
}
